﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wormhole.Engine.CardLibrary.BaseCardTypes;

namespace Wormhole.Engine.CardLibrary.CardTypes
{
	/// <author>Rodney McKay</author>
	/// <date>04 April 2008</date>
	/// <summary>
	/// This class implement the properties for a character card.
	/// </summary>
	public abstract class Character : SkillsCard
	{
		#region Properties

		#region Earned Glyphs
		/// <summary>
		/// Glyphs that the character have earned.
		/// </summary>
		public Glyphs.EarnedGlyphs EarnedGlyphs { get; set; }
		#endregion

		#endregion

		#region Constructor
		/// <summary>
		/// Initialize a new instance of the class.
		/// </summary>
		/// <param name="owner">The card owner.</param>
		public Character(Player.Player owner)
			: base(owner)
		{
			this.EarnedGlyphs = new Glyphs.EarnedGlyphs();
		}
		#endregion	
	
		#region Can Assign
		/// <summary>
		/// This method checks wether or not the player can assign a card to the mission.
		/// </summary>
		/// <returns>Returns true if the card can be assigned to a mission.</returns>
		public override bool CanAssign()
		{
			bool canAssign = false;

			if (this.Owner.HasPriority)
			{
				// unassigned team charactes may always be assigned, while unassigned support charactes can only be assigned if they have the mission skill
				if ((this.InputStatus == InputStatus.AllowAssign) && (this.Status == CardStatus.Unassigned))
				{
					if (this.Traits.Contains(CardProperties.Trait.Team))
						canAssign = true;
					else if (this.Skills[this.Owner.Game.Mission.CurrentMission.Type] != null)
						canAssign = true;
				}
			}

			return canAssign;
		}
		#endregion
	}
}
